const mongoose = require('mongoose'); //引用

// const dbPath = "mongodb://47.108.201.43:27017/huayi"
const dbPath = "mongodb://127.0.0.1:27017/huayi"
mongoose.connect(dbPath, { useNewUrlParser: true, useUnifiedTopology: true })// 配这个,不会出现警告

mongoose.connection.on("connected", () => {
    console.log("mongodb连接成功")
})

mongoose.connection.on("error", () => {
    console.log("error")
})

mongoose.connection.on("disconnected", () => {
    console.log("mongodb断开连接");
});
